<template>
    <div class="app-container">
        <el-card shadow="never">
            <div>
                <div class="flex justify-between align-center">
                    <div>
                        <p><span style="color:#fd2f2f;">当前美国时区:(-8)：{{ us_time | parseTime('y-m-d h:i:s 星期a') }}</span>
                        </p>
                    </div>
                </div>
            </div>
            <el-row>
                <el-col :span="12">
                    <el-card class="box-card">
                        <div slot="header" class="clearfix">
                            <span>统计未处理订单</span>
                            <span style="">
                                <template>
                                        <el-select
                                            v-model="site_id"
                                            filterable
                                            @change="select_change"
                                            style="min-width:300px"
                                            placeholder="选择店铺">
                                                <el-option
                                                    v-for="item in site_arr"
                                                    :key="item.id"
                                                    :label="item.name"
                                                    :value="item.id"
                                                    >
                                                    <span style="float: left">{{ item.name }}</span>
                                                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.region }}</span>
                                                </el-option>
                                        </el-select>
                                    </template>
                                    <template>
                                        <el-date-picker
                                            v-model="datetime" 
                                            type="daterange" 
                                            range-separator="至" 
                                            start-placeholder="开始日期" 
                                            end-placeholder="结束日期">
                                        </el-date-picker>
                                    </template>
                                    <el-button type="primary" size="mini" @click="searchs" icon="el-icon-search" class="ele-btn-icon">搜索 </el-button>
                            </span>
                            <!-- <el-button style="float: right; padding: 3px 0" type="text">详情</el-button> -->
                        </div>
                        <div class="text item">
                            <p>发货预警:<span style="font-size: 24px;">{{track_count.count1}}</span><span style="float: right;">
                                <!-- <el-button
                                    plain
                                    @click="track1('面单超时范围18-24小时')">
                                    超时判定
                                </el-button> -->
                                面单超时范围18-24小时
                            </span></p>
                            <p>发货超时:<span style="font-size: 24px;">{{track_count.count2}}</span><span style="float: right;">
                                面单超过24小时以上
                                <!-- <el-button
                                    plain
                                    @click="track1('面单超过24小时以上')">
                                    超时判定
                                </el-button> -->
                            </span></p>
                            <p>物流轨迹预警:<span style="font-size: 24px;">{{track_count.count3}}</span><span style="float: right;">
                                物流轨迹超时范围36-48小时
                                <!-- <el-button
                                    plain
                                    @click="track1('物流轨迹超时范围36-48小时')">
                                    超时判定
                                </el-button> -->
                            </span></p>
                            <p>物流轨迹超时:<span style="font-size: 24px;">{{track_count.count4}}</span><span style="float: right;">
                                物流轨迹超过48小时以上
                                <!-- <el-button
                                    plain
                                    @click="track1('物流轨迹超过48小时以上')">
                                    超时判定
                                </el-button> -->
                            </span></p>
                            <p>物流轨迹异常:<span style="font-size: 24px;">{{track_count.count5}}</span><span style="float: right;">
                                物流轨迹异常
                                <!-- <el-button
                                    plain
                                    @click="track1('物流轨迹异常')">
                                    超时判定
                                </el-button> -->
                            </span></p>
                            <p>妥投已超时:<span style="font-size: 24px;">{{track_count.count6}}</span><span style="float: right;">
                                物流轨迹超过156小时以上
                                <!-- <el-button
                                    plain
                                    @click="track1('物流轨迹超过156小时以上')">
                                    超时判定
                                </el-button> -->
                            </span></p>
                        </div>
                    </el-card>
                </el-col>
                <el-col :span="12">
                    <el-card class="box-card">
                        <div slot="header" class="clearfix">
                            <span>统计17track状态</span>
                            <!-- <el-button style="float: right; padding: 3px 0" type="text">详情</el-button> -->
                        </div>
                        <div class="text item">
                            <p>等待上门取件:<span style="font-size: 24px;">{{list_counts.InfoReceived}}</span><span style="float: right;">
                                收到信息，运输商收到下单信息，等待上门取件
                                <!-- <el-button
                                    plain
                                    @click="track1('收到信息，运输商收到下单信息，等待上门取件')">
                                    状态解释
                                </el-button> -->
                            </span></p>
                            <p>运输过久:<span style="font-size: 24px;">{{list_counts.Expired}}</span><span style="float: right;">
                                运输过久，包裹已经运输了很长时间而仍未投递成功
                                <!-- <el-button
                                    plain
                                    @click="track1('运输过久，包裹已经运输了很长时间而仍未投递成功')">
                                    状态解释
                                </el-button> -->
                            </span></p>
                            <p>到达待取:<span style="font-size: 24px;">{{list_counts.AvailableForPickup}}</span><span style="float: right;">
                                <!-- 到达待取，包裹已经到达目的地的投递点，需要收件人自取 -->
                                <el-button
                                    plain
                                    @click="track1('到达待取，包裹已经到达目的地的投递点，需要收件人自取')">
                                    状态解释
                                </el-button>
                            </span></p>
                            <p>派送途中:<span style="font-size: 24px;">{{list_counts.OutForDelivery}}</span><span style="float: right;">
                                派送途中，包裹正在投递过程中
                                <!-- <el-button
                                    plain
                                    @click="track1('派送途中，包裹正在投递过程中')">
                                    状态解释
                                </el-button> -->
                            </span></p>
                            <p>投递失败:<span style="font-size: 24px;">{{list_counts.DeliveryFailure}}</span><span style="float: right;">
                                投递失败，包裹尝试派送但未能成功交付
                                <!-- <el-button
                                    plain
                                    @click="track1('投递失败，包裹尝试派送但未能成功交付')">
                                    状态解释
                                </el-button> -->
                            </span></p>
                            <p>异常:<span style="font-size: 24px;">{{list_counts.Exception}}</span><span style="float: right;">
                                可能异常，包裹可能被退回
                                <!-- <el-button
                                    plain
                                    @click="track1('可能异常，包裹可能被退回')">
                                    状态解释
                                </el-button> -->
                            </span></p>
                        </div>
                    </el-card>
                </el-col>
            </el-row>
            <el-card class="box-card">
                <el-steps :active="stepsactive" align-center>
                    <el-step title="用户下单" description=""></el-step>
                    <el-step title="发货预警" description="预警18小时以内是否出面单"></el-step>
                    <el-step title="发货超时" description="24小时以内必须出面单"></el-step>
                    <el-step title="物流轨迹预警" description="预警36小时以内是否出物流轨迹"></el-step>
                    <el-step title="物流轨迹超时" description="48小时以内必须出物流轨迹"></el-step>
                    <el-step title="物流轨迹异常" description="96小时以内物流轨迹是否正常"></el-step>
                    <el-step title="妥投已超时" description="156小时以内必须妥投"></el-step>
                </el-steps>
            </el-card>

            <!-- 条件查询 -->
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>筛选</span>
                </div>
                <el-form v-show="showSearch" ref="queryForm" :model="queryParams" label-width="120px" @keyup.enter.native="submitSearch" @submit.native.prevent>
                    <el-row>
                        <el-col :md="6" :sm="12">
                            <el-form-item label="订单号:" prop="order_id.value">
                                <el-input type="textarea" :rows="4" v-model="queryParams.order_id.value" placeholder="请输入订单号" clearable />
                            </el-form-item>
                        </el-col>
                        <el-col :md="6" :sm="12">
                            <el-form-item label="跟踪号:" prop="tracking_number.value">
                                <el-input v-model="queryParams.tracking_number.value" placeholder="请输入跟踪号" clearable />
                            </el-form-item>
                        </el-col>
                        <el-col :md="6" :sm="12">
                            <el-form-item label="17track状态:" prop="tracking_latest_status.value">
                                    <el-select v-model="queryParams.tracking_latest_status.value" placeholder="请选择" clearable>
                                        <el-option
                                            v-for="item in tracking_latest_statusa"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                        </el-option>
                                    </el-select>
                            </el-form-item>
                        </el-col> 
                        <!-- <el-col :md="6" :sm="12">
                            <el-form-item label="SKU:" prop="sku.value">
                                <el-input v-model="queryParams.sku.value" placeholder="请输入SKU" clearable />
                            </el-form-item>
                        </el-col> -->
                        
                        <!-- <el-col :md="6" :sm="12">
                            <el-form-item label="姓名:" prop="name.value">
                                <el-input v-model="queryParams.name.value" placeholder="请输入姓名" clearable />
                            </el-form-item>
                        </el-col> -->
                        
                        <!-- <el-col :md="6" :sm="12">
                            <el-form-item label="取消原因:" prop="cancel_reason.value">
                                <SelectPage v-model="queryParams.cancel_reason.value" :url="'/admin/order/selectPage_cancel_reason'" placeholder="请选择取消原因" :multiple="false" />
                            </el-form-item>
                        </el-col> -->

                        <!-- <el-col :md="6" :sm="12">
                            <el-form-item label="取消原因:" prop="cancel_reason.value">
                                <el-select v-model="queryParams.cancel_reason.value" multiple collapse-tags placeholder="请选择">
                                    <el-option
                                    v-for="item in cancel_reasons"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col> -->
                        <!-- <el-col :md="6" :sm="12">
                            <el-form-item label="运输类型:" prop="fulfillment_type.value">
                                <el-input v-model="queryParams.fulfillment_type.value" placeholder="请输入运输类型" clearable />
                            </el-form-item>
                        </el-col> -->
                        <!-- <el-col :md="6" :sm="12">
                            <el-form-item label="下单时间:" prop="createtime.value">
                                <el-date-picker
                                    v-model="queryParams.createtime.value"
                                    type="datetimerange"
                                    range-separator="至"
                                    start-placeholder="开始"
                                    end-placeholder="结束"
                                    align="right"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                >
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :md="6" :sm="12">
                            <el-form-item label="发货时间:" prop="tracking_latest_time.value">
                                <el-date-picker
                                    v-model="queryParams.tracking_latest_time.value"
                                    type="datetimerange"
                                    range-separator="至"
                                    start-placeholder="开始"
                                    end-placeholder="结束"
                                    align="right"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                >
                                </el-date-picker>
                            </el-form-item>
                        </el-col> -->
                        <!-- 
                        <el-col :md="6" :sm="12">
                            <el-form-item label="店铺:" prop="site_id.value">
                                <SelectPage v-model="queryParams.site_id.value" :url="'/admin/site/selectPage'" show_field="name" placeholder="请选择店铺" query_field="name" :multiple="false" />
                            </el-form-item>
                        </el-col> -->
                        <el-col :md="6" :sm="12">
                            <el-form-item class="ele-text-right" label-width="50px">
                                <el-button type="primary" size="mini" @click="submitSearch" icon="el-icon-search" class="ele-btn-icon">搜索 </el-button>
                                <el-button @click="resetQuery" size="mini" icon="el-icon-refresh">重置</el-button>

                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </el-card>
            

            <!-- <template>
                <el-table
                    :data="count_msg"
                    v-loading="loading"
                    style="width: 100%"
                    height="250">
                    <el-table-column
                        prop="count"
                        label="单量"
                        width="">
                    </el-table-column>
                    <el-table-column
                        label="状态"
                        width="">
                        <template slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                            <p>状态: {{ scope.row.tracking_latest_status }}</p>
                            <p>状态解释: {{ scope.row.tracking_latest_statusinfo }}</p>
                            <div slot="reference" class="name-wrapper">
                                <el-tag size="medium">{{ scope.row.tracking_latest }}</el-tag>
                            </div>
                            </el-popover>
                        </template>
                    </el-table-column>
                </el-table>
            </template> -->
            
            <el-row :gutter="10" class="mb8" style="margin: 15px 0;">
                <!-- <el-col :span="1.5">
                    <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="open" v-hasPermi="api.add">添加</el-button>
                </el-col> -->
                <!-- <el-col :span="1.5">
                    <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="api.delete">删除</el-button>
                </el-col> -->
                <el-col :span="1.5">
                    <el-upload
                        class="upload-demo"
                        ref="upload"
                        :action="api.upload"
                        :on-preview="handlePreview"
                        :on-remove="handleRemove"
                        :on-success="handleUploadSuccess"
                        :on-error="handleUploadError"
                        :file-list="fileList"
                        :auto-upload="false">
                        <el-button slot="trigger" size="mini" type="primary">选择文件</el-button>
                        <el-button style="margin-left: 10px;" size="mini" type="success" @click="submitUpload">上传已处理订单</el-button>
                    </el-upload>
                </el-col>
                <el-col :span="1.5">
                    <el-button type="warning" plain icon="el-icon-download" size="mini" v-loading="exportLoading" @click="handleExport" v-hasPermi="api.export">导出</el-button>
                </el-col>
                <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="initIndex" :columns="columns" printId="#quickadmin"></right-toolbar> -->
            </el-row>
            <!-- 列表 -->
            <el-tabs v-model="activeTab" @tab-click="handleStatus" type="border-card">
                <el-tab-pane v-for="(item, index) in status" :key="index" :label="item.label" :name="item.value.toString()">
            <qa-table
                :source="tableData"
                :columns="columns"
                :selection="true"
                :loading="loading"
                @sortChange="sortChange"
                @statusChange="statusChange"
                @selectionChange="selectionChange"
                id="quickadmin"
            >
                <template v-slot:action>
                    <el-table-column label="操作" width="" align="left">
                        <template slot-scope="scope">
                            <el-button class="btn-mar" size="mini" type="primary" icon="el-icon-edit" @click="handleEdit(scope.row)" v-hasPermi="api.edit">轨迹</el-button>
                            <!-- <el-button class="btn-mar" size="mini" type="info" @click="handleDetail(scope.row)" v-hasPermi="api.find">详情</el-button> -->
                            <!-- <el-button class="btn-mar" size="mini" type="danger"  @click="handledelivery_again(scope.row)" v-hasPermi="api.delivery_again">重新发货</el-button> -->
                        </template>
                    </el-table-column>
                </template>
            </qa-table>
            </el-tab-pane>
            </el-tabs>

            <el-dialog :title="title1" :visible.sync="dialogTableVisible">
                <el-table :data="msgdata">
                    <el-table-column property="msg" label="日志" width=""></el-table-column>
                </el-table>
            </el-dialog>

            <!-- 分页 -->
            <pagination :total="total" :page.sync="pageInfo.page" :limit.sync="pageInfo.limit" @pagination="initIndex" />
        </el-card>

        <!-- 编辑弹窗 -->
        <el-dialog :title="!disabled ? '编辑' : '详情'" :visible="editOpen"  :before-close="beforeClose" destroy-on-close>
            <EditForm ref="editForm" :findFormData="findFormData"  :disabled="disabled" @submitForm="submitForm" :editFormParams="editFormParams" @editFormCancel="beforeClose" />
        </el-dialog>

    </div>
</template>

<script>
import { curdMixin } from '@/mixins/curdMixin'
import EditForm from './EditFormCom'
export default {
    name: 'Curd',
    mixins: [curdMixin],
    components: { EditForm },
    
    data() {
        return {
            site_arr: [],
            site_id: "",
            datetime: "",
            tracking_latest_statusa: [{
                value: 'NotFound',
                label: '查询不到'
                }, {
                value: 'InfoReceived',
                label: '等待上门取件'
                }, {
                value: 'InTransit',
                label: '运输途中'
                }, {
                value: 'Expired',
                label: '运输过久'
                }, {
                value: 'AvailableForPickup',
                label: '到达待取'
                }, {
                value: 'OutForDelivery',
                label: '派送途中'
                }, {
                value: 'DeliveryFailure',
                label: '投递失败'
                }, {
                value: 'Delivered',
                label: '成功签收已妥投'
                }, {
                value: 'Exception',
                label: '异常'
                }
            ],
            fileList: [],
            cancel_reasons: [],
            overseas_warehouse_arr: [
                {
                    value: '1',
                    label: 'JJS'
                },
                // {
                //     value: '2',
                //     label: '全球无忧美国TK海外仓'
                // },
                {
                    value: '3',
                    label: '金蚁'
                },
                {
                    value: '4',
                    label: '顺丰'
                }
            ],
            golden_ant_channel: [
                {
                    value: '1003',
                    label: 'HWC-TK'
                },
                {
                    value: '2015',
                    label: 'TiK-shop'
                },
                {
                    value: '2011',
                    label: 'HWC-SD'
                },
                {
                    value: '1010',
                    label: 'HWC-artificial'
                },
                {
                    value: '1009',
                    label: '海外仓一6日签'
                }
            ],
            overseas_warehouse: '3',
            golden_ant: '1003',
            dialogTableVisible: false,
            title1: '请等待',
            stepsactive: 0,
            us_time: 0,
            //统计
            track_count: {
                count1: 0,
                count2: 0,
                count3: 0,
                count4: 0,
                count5: 0,
                count6: 0,
            },
            list_counts: {
                NotFound: 0,
                InfoReceived: 0,
                InTransit: 0,
                Expired: 0,
                AvailableForPickup: 0,
                OutForDelivery: 0,
                DeliveryFailure: 0,
                Delivered: 0,
                Exception: 0,
            },
            
            // table结构
            columns: [
                {
                    visible: true,
                    label: '物流跟踪号',
                    prop: 'tracking_number',
                },
                {
                    visible: true,
                    label: '物流状态',
                    width: '150',
                    prop: 'tracking_latest_status',
                    component: 'QuickAdminTag',
                    formatter: (prop, row) => {
                        return row.tracking_latest_status
                    },
                },
                {
                    visible: true,
                    label: '未发货/小时',
                    sortable: 'custom',
                    prop: 'unshipped_often',
                },
                {
                    visible: true,
                    label: '出物流轨迹/小时',
                    sortable: 'custom',
                    prop: 'logistics_trajectory',
                },
                {
                    visible: true,
                    label: '在途/小时',
                    prop: 'in_transit_time',
                },
                {
                    visible: true,
                    label: '订单号',
                    prop: 'order_id',
                },
                {
                    visible: true,
                    label: '订单状态',
                    prop: 'status',
                },
                {
                    visible: true,
                    label: '下单时间',
                    sortable: 'custom',
                    prop: 'createtime',
                },
                {
                    visible: true,
                    label: '发货时间(美国时间)',
                    sortable: 'custom',
                    prop: 'tracking_latest_time',
                },
                {
                    visible: true,
                    label: '出物流轨迹(美国时间)',
                    sortable: 'custom',
                    prop: 'logistics_trajectory_time',
                },
                // {
                //     visible: true,
                //     label: 'SKU详情',
                //     prop: 'skus_info',
                // },
                {
                    visible: true,
                    label: '仓库',
                    prop: 'warehouse_name',
                },
                {
                    visible: true,
                    label: '店铺',
                    prop: 'site_name',
                },
                // {
                //     visible: true,
                //     label: '轨迹类型',
                //     prop: 'track_status',
                //     component: 'QuickAdminTag',
                //     formatter: (prop, row) => {
                //         if(row.track_status == "prepare"){
                //             row.track_status = '获取轨迹中'
                //         }
                //         if(row.track_status == "accepted"){
                //             row.track_status = '正常'
                //         }
                //         if(row.track_status == "rejected"){
                //             row.track_status = '异常'
                //         }
                //         return row.track_status
                //     },
                // },
            ],
            // 接口地址
            api: {
                index: `/admin/ordertrack/index`,
                find: `/admin/ordertrack/find`,
                add: `/admin/ordertrack/add`,
                edit: `/admin/ordertrack/edit`,
                delete: `/admin/ordertrack/delete`,
                export: `/admin/ordertrack/export`,
                upload: `https://tiktokapi.yilebuy.com/admin/ordertrack/uploads`,
                automatic_shipping: `/admin/ordertrack/automatic_shipping`,
                delivery_again: `/admin/ordertrack/delivery_again`,
                status: `/admin/ordertrack/status`
            },
            editFormParams: {
            },
            pageInfo: {
                sort: 'createtime',
            },
            primaryKey: 'id',
            // 搜索表单是否展开
            searchExpand: false,
              //是否展示搜索
            showSearch: true,
            // 查询参数
            queryParams: {
                order_id: { value:undefined, op: '%like%'},
                sku: { value:undefined, op: '%like%'},
                tracking_number: { value:undefined, op: '%like%'},
                name: { value:undefined, op: '%like%'},
                fulfillment_type: { value:undefined, op: '%like%'},
                createtime: { value:[], op: 'range'},
                tracking_latest_time: { value:[], op: 'range'},
                status_track: { value:[], op: '='},
                site_id: { value:[], op: '='},
                cancel_reason: { value:[], op: '='},
                tracking_latest_status: { value:[], op: '='},
            },
            status: [
                { label: '全部', value: '' },
                { label: '发货预警', value: '1' },
                { label: '发货超时', value: '2' },
                { label: '物流轨迹预警', value: '3' },
                { label: '物流轨迹超时', value: '4' },
                { label: '物流轨迹异常', value: '5' },
                { label: '妥投已超时', value: '6' },
                { label: '17track状态异常件', value: '7' },
            ],
            activeTab: '',
            msgdata:[],

        }
    },
    created () {
        this.initIndex()
        this.now();
        this.statistics();
        this.site();
    },
    watch: {
        
    },
    methods: {
        async site() {
            let response = await this.request.post('/admin/datapanel/dashboard_site', {})
            if(response.code == 1){
                this.site_arr = response.data;
            }
        },
        searchs() {
            this.statistics();
        },
        select_change(val) {
            this.statistics();
        },
        async statistics() {
            let response = await this.request.post('/admin/ordertrack/statistics', {
                site_id: this.site_id,
                datetime: this.datetime
            })
            this.list_counts = response.list_counts;
            this.track_count = response.track_count;
        },
        // 北京时间
        now() {
            this.us_time = new Date().getTime() - 16 * 3600 * 1000;
            setInterval(() => {
                this.us_time = new Date().getTime() - 16 * 3600 * 1000;
            }, 1000)
        },
        // 再次发货
        handledelivery_again (row) {
            if(this.overseas_warehouse == ''){
                return this.msgError('请选择仓库再操作')
            }
            let tableIds = row[this.primaryKey] || this.ids
            tableIds = tableIds.toString()
            this.$confirm(`已选择仓库${this.overseas_warehouse},是否确认重新发货?`, '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.dialogTableVisible = true;
                this.msgdata = [];
                this.title1 = '请等待';
                this.delivery_again2(tableIds,this.overseas_warehouse)
            }).then(() => {
                // this.initIndex()
                // this.msgSuccess('操作成功')
            }).catch(() => { })
        },
        async delivery_again2(tableIds,overseas_warehouse) {
            let response = await this.request.get(this.api.delivery_again, { params: { id:tableIds,overseas_warehouse:overseas_warehouse } })
            this.msgdata = response.data;
            this.title1 = '操作成功';
            this.initIndex()
        },

        // 案列：当前组件格式化方法
        testFormatter(prop) {
            return prop
        },

        submitUpload() {
            this.loading = true
            this.$refs.upload.submit();
        },
        handleRemove(file, fileList) {
            console.log(file, fileList);
        },
        handlePreview(file) {
            console.log(file);
        },
        track1(msg) {
            const h = this.$createElement;
            this.$notify({
            title: '详情',
            message: h('i', { style: 'color: teal'}, msg)
            });
        },
        // 上传成功回调
        handleUploadSuccess(res) {
            this.loading = false
            if (res.code == 1) {
                this.$notify({
                    title: '成功',
                    message: res.data,
                    type: 'success'
                });
                // this.$message.success(res.data);
                this.initIndex();
            } else {
                this.$message({
                    type: 'error',
                    message: '上传失败'+res.msg,
                })
            }
        },
        // 上传失败
        handleUploadError() {
            this.$message({
                type: 'error',
                message: '上传失败',
            })
        },
        
        //     // 详情
        // handleDetail(row) {
        //     this.handleFindDetail(row)
        // },

        // async handleFindDetail(row) {
        //     let response = await this.request.get(this.api.find, { params: {order_id:row.order_id}})
        //     this.findFormData = this.formatFindData(response.data)
        //     this.editOpen = true
        // },
          //订单状态切换
        handleStatus(tab) {
            this.queryParams.status_track.value = tab.name
            if(tab.name == ""){
                this.stepsactive = 0
            }else{
                this.stepsactive = tab.name;
                this.stepsactive = this.stepsactive++;
            }
            console.log('test',this.stepsactive);
            
            this.submitSearch()
        },

        handleModification(row) {
            // console.log('this.ids.length',this.ids.length);
            // if(this.ids.length>10){
            //     return this.msgError('发货一次不超过10条')
            // }
            if(this.ids == ''){
                return this.msgError('请勾选再操作')
            }
            if(this.overseas_warehouse == ''){
                return this.msgError('请选择仓库再操作')
            }
            this.$confirm(`是否确认自动发货，过程大概需要一分钟?`, '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(() => {
                    this.loading = true
                    // this.dialogTableVisible = true;
                    // this.msgdata = [];
                    // this.title1 = '请等待';
                    // test
                    this.automatic_shippings()
                })
                .catch(() => {})
        },

        async automatic_shippings() {
            let response = await this.request.get(this.api.automatic_shipping, { params: { id:this.ids ,warehouse:this.overseas_warehouse,golden_ant:this.golden_ant} })
            // this.msgdata = response.data;
            // this.title1 = '操作成功';
            this.initIndex()
            this.msgSuccess('操作成功，请在发货日志中查看明细')
            this.loading = false
        },
        
    }
}
</script>
<style lang="scss">
.btn-mar {
    margin: 5px !important;
}
</style>
